<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    use HasFactory;

    protected $table = 'category';

    /**
     * 指定哪些属性可以在使用 create() 或 update() 方法时被批量赋值
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'name',
        'image',
        'pid',
        'order',
        'status'
    ];

    /**
     * 隐藏字段
     *
     * @var array<int, string>
     */
    protected $hidden = [

    ];

    /**
     * 默认情况下 $timestamps 为 true，表示启用自动管理
     *
     * @var bool
     */
    public $timestamps = true;

    /**
     * 字段输出格式转换
     * @var string[]
     */
    protected $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s',
    ];
}
